//js ui版本路径
var refVersionPath = "resource/v1";


// 引入gulp 基础库
// gulp 基础库
var gulp = require("gulp"),
    // css压缩
    minifycss = require("gulp-minify-css"),
    // 合并文件
    concat = require("gulp-concat"),
    // js 压缩
    uglify = require("gulp-uglify"),
    // 文件重命名
    rename = require("gulp-rename"),
    // js检查
    // jshint = require("gulp-jshint"),
    // 提示
    notify = require("gulp-notify");
    less = require('gulp-less'),
    minifyCss = require('gulp-minify-css'),
    minify = require('gulp-minify'),
    zip = require('gulp-zip'),
    moment = require("moment"),
    ftp = require('gulp-ftp'),
    git = require('gulp-git'),
    runSequence = require('run-sequence'),
    argv = require('minimist')(process.argv.slice(2)),
    del = require('del'),
    htmlmin = require('gulp-htmlmin'),
    ngAnnotate = require('gulp-ng-annotate');

//默认任务
gulp.task('default', function () {
    gulp.start("uglify");
});

// js处理
gulp.task("js", function () {
    return gulp.src([
        './js/basic_config.js',
        './'+refVersionPath+'/js/adaptor.js',
        './'+refVersionPath+'/js/desktop.js',
        './'+refVersionPath+'/extjs/app/app.js',
        './'+refVersionPath+'/extjs/app/ux/imgField.js',
        './'+refVersionPath+'/extjs/app/ux/jform.js',
        './'+refVersionPath+'/extjs/app/ux/jgrid.js',
        './'+refVersionPath+'/extjs/app/ux/jMultiSelect.js',
        './'+refVersionPath+'/extjs/app/ux/jselectgrid.js',
        './'+refVersionPath+'/extjs/app/ux/jselecttree.js',
        './'+refVersionPath+'/extjs/app/ux/jtree.js',
        './'+refVersionPath+'/extjs/app/ux/juser.js',
        './'+refVersionPath+'/extjs/app/ux/jview.js',
        './'+refVersionPath+'/extjs/app/ux/master.js',
        './'+refVersionPath+'/extjs/app/ux/mix.js',
        './'+refVersionPath+'/extjs/app/ux/Notification.js',
        './'+refVersionPath+'/extjs/app/main.js'])  //选择合并的JS
        .pipe(concat('app-all.js'))   //合并js
        // .pipe(rename({suffix: '.min'}))     //重命名
        .pipe(uglify())                    //压缩
        .pipe(gulp.dest('./'+refVersionPath+'/extjs'))            //输出
        .pipe(notify({message: "js task ok"}));    //提示
});
